import 'package:flutter/material.dart';
import 'package:ost_flutter_module/common/adapt.dart';
import 'package:ost_flutter_module/common/color.dart';

class RoundedButton extends StatelessWidget {
  final double buttonWidth;
  final bool isEnable;
  final Color enableColor;
  final Color disableColor;
  final String text;
  final double verticalPadding;
  final Color textColor;
  final double textSize;
  final VoidCallback onTap;

  const RoundedButton(
      {Key key,
      @required this.buttonWidth,
      @required this.text,
      @required this.onTap,
      this.isEnable = true,
      this.enableColor = colorFACD33,
      this.disableColor = color4DD1D1D1,
      this.verticalPadding = 8,
      this.textColor = Colors.white,
      this.textSize = 20})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: buttonWidth,
      child: FlatButton(
        onPressed: isEnable ? onTap : null,
        color: enableColor,
        disabledColor: disableColor,
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(Adapt.px(30))),
        padding: EdgeInsets.symmetric(vertical: verticalPadding),
        child: Text(
          text,
          style: TextStyle(fontSize: textSize, color: textColor),
        ),
      ),
    );
  }
}
